// makeswf -v 7 -r 1 -o native-run-7.swf native-run.as

trace ("Running all native functions to find crashes");
trace ("Using undefined, movieclip, object and number as this");

// FIXME: List is not complete, check when implemting new native functions
var native_functions = [
  [4,0], [4,1], [5,0], [5,1], [11,0], [100,0], [100,1], [100,2], [100,3],
  [100,5], [101,0], [101,1], [101,10], [101,11], [101,12], [101,2], [101,3],
  [101,4], [101,5], [101,6], [101,7], [101,8], [103,0], [103,1], [103,10],
  [103,11], [103,12], [103,128], [103,13], [103,14], [103,15], [103,16],
  [103,17], [103,18], [103,19], [103,2], [103,20], [103,257], [103,3], [103,4],
  [103,5], [103,6], [103,7], [103,8], [103,9], [104,0], [104,101], [104,102],
  [104,103], [104,104], [104,105], [104,106], [104,107], [104,200], [104,201],
  [106,0], [106,1], [107,0], [107,1], [111,0], [111,100], [111,101], [111,102],
  [112,100], [112,101], [112,102], [113,100], [113,101], [113,102], [113,103],
  [200,0], [200,1], [200,10], [200,11], [200,12], [200,13], [200,14], [200,15],
  [200,16], [200,17], [200,18], [200,19], [200,2], [200,3], [200,4], [200,5],
  [200,6], [200,7], [200,8], [200,9], [250,0], [250,1], [250,2], [251,1],
  [251,10], [251,11], [251,12], [251,13], [251,14], [251,2], [251,3], [251,4],
  [251,5], [251,6], [251,7], [251,8], [251,9], [252,1], [252,10], [252,11],
  [252,12], [252,2], [252,3], [252,4], [252,5], [252,6], [252,7], [252,8],
  [252,9], [253,1], [253,10], [253,11], [253,12], [253,2], [253,3], [253,4],
  [253,5], [253,6], [253,7], [253,8], [301,0], [301,2], [301,3], [400,0],
  [400,1], [400,2], [500,6], [500,7], [500,8], [600,0], [600,1], [600,2],
  [600,3], [600,4], [600,5], [666,1], [666,2], [666,3], [666,4], [666,5],
  [666,6], [666,7], [666,8], [700,0], [700,1], [700,2], [700,3], [800,0],
  [800,1], [800,2], [900,0],
  /* swapDepths: [900,1], */
  [900,10], [900,12], [900,13], [900,14], [900,15], [900,16], [900,17],
  [900,18], [900,19], [900,20], [900,21], [900,4], [900,5], [900,6], [900,7],
  [901,0], [901,1], [901,2], [901,3], [901,4], [901,5], [901,6], [901,7],
  [901,8], [1067,0], [1067,1], [1067,2], [1067,3], [1067,4], [1067,5],
  [1067,6], [1067,7], [1067,8], [1067,9], [1112,1], [1999,0], [1999,1],
  [1999,2], [2102,0], [2102,1], [2102,2],
  /* Camera: */ [2102,200], [2102,201],
  [2102,3], [2102,4], [2102,5], [2104,0], [2104,1], [2104,2], [2104,200],
  [2104,201], [2104,3], [2150,0], [2150,1], [2150,10], [2150,11], [2150,2],
  [2150,3], [2150,4], [2150,5], [2200,0], [2200,1], [2200,2], [2200,3],
  [2204,0], [2204,1], [2204,2], [2204,200], [2204,3], [2205,0]
];

for (var i = 0; i < native_functions.length; i++) {
  var o = new Object ();
  var n = new Number ();
  var func = ASnative (native_functions[i][0], native_functions[i][1]);
  o.func = func;
  n.func = func;

  var args = [];
  for (var j = 0; j < 10; j++) {
    args.push (j);
    func.apply (this, args);
    o.func.apply (this, args);
    n.func.apply (this, args);
  }

  // this way the function is called with this being undefined
  setTimeout (func, 0);
  setTimeout (func, 0, 1);
  setTimeout (func, 0, 1, 2);
  setTimeout (func, 0, 1, 2, 3);
  setTimeout (func, 0, 1, 2, 3, 4);
  setTimeout (func, 0, 1, 2, 3, 4, 5);
}

trace ("Done");

loadMovie ("FSCommand:quit", "");
